package com.epalmpay.service.yunstream;


import java.util.HashMap;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.epalmpay.bean.FlowChargeOrderBean;
import com.epalmpay.bean.OilcardChargeOrderBean;
import com.epalmpay.bean.OilcardRechargeInfoBean;
import com.epalmpay.dto.yunliu.oilcard.OilcardChargeListInDTO;
import com.epalmpay.dto.datareport.BaseReportInDTO;
import com.epalmpay.dto.datareport.FlowChargeReportInfoListOutDTO;
import com.epalmpay.dto.datareport.FlowChargeReportListOutDTO;
import com.epalmpay.dto.datareport.OilChargeReportInfoListOutDTO;
import com.epalmpay.dto.datareport.OilChargeReportListOutDTO;
import com.epalmpay.dto.system.BaseOutDTO;
import com.epalmpay.dto.yunliu.oilcard.BaseOilOrderInDTO;
import com.epalmpay.dto.yunliu.oilcard.CancelOilChargeInDTO;
import com.epalmpay.dto.yunliu.oilcard.CreateOilOrderInDTO;
import com.epalmpay.dto.yunliu.oilcard.FlowOrderListInDTO;
import com.epalmpay.dto.yunliu.oilcard.OilCardOrderReChargeInDTO;
import com.epalmpay.entity.Page;
import com.epalmpay.entity.TradeOffline;
import com.epalmpay.entity.YsFlowChargeOrder;
import com.epalmpay.entity.YsOilcardOrder;
import com.epalmpay.entity.YsOilcardRechargeInfo;
import com.epalmpay.entity.YsOilcardRepOrder;
import com.epalmpay.exception.ApplicationException;
import com.epalmpay.payplat.result.PayNotifyCallback;
import com.epalmpay.util.Response;




/**
 * @author fei
 * @Time：2017年5月24日 下午1:34:17
 * @version 1.0
 */
public interface IOilcardOrderService {

	/**
	 * 生成订单
	 * insertOilcardOrder:(). 
	 * @author fei 
	 * @Time：2017年5月24日 下午2:14:49
	 * @param oilcardOrder
	 * @param oilcardId 
	 * @return
	 */
	Response insertOilcardOrder(CreateOilOrderInDTO oilcardOrder);
	

	/**
	 * 查询单月订单记录
	 * selectMonthOrderList:(). 
	 * @author fei 
	 * @Time：2017年5月26日 下午2:04:57
	 * @param memberId
	 * @param monthTime
	 * @return
	 */
	List<YsOilcardOrder> selectMonthOrderList(Long memberId, String monthTime);
	
    /***
     * 钱包交易，进行充值
     * @param goodsOrderId
     * @param goodsOrderPrice
     * @param payPwd
     * @param memberId
     * @param groupId
     * @return
     */
	Response oilChargeOrderPay(Long goodsOrderId, Integer goodsOrderPrice, String payPwd, Long memberId,
			String groupId) throws ApplicationException;

	
	/**
	 * 银行卡或者 微信支付 通知的处理
	 * @param notify
	 * @return
	 */
	public TradeOffline oilCrdPayNotify(String orderNum,String transResult,String orderNo);

	/**
	 * 
	 * @param member
	 * @return
	 */
	public int canRechargeAmount(String ysmemberId,String businessCode );
	
	


	YsOilcardOrder finishOidCardOrderById(Long orderId);
	

	
	
	Response oilChargeOrderWeixinPay(Long goodsOrderId, Integer goodsOrderPrice, Long memberId, String groupId,String ip);

	boolean paySuccessCommon(YsOilcardOrder order , Integer payType);
	
	

	YsOilcardOrder findOilChargeOrderInfo(Long orderId);

	Response oilChargeOrderAliPay(Long goodsOrderId, Integer price, Long memberId, String groupId, String ip);


	YsOilcardRechargeInfo findOilReChargeOrderInfo(Long oilCardChargeId);

    /**
     * 返回1 表示当前处于 套餐中，0表示没有
     * @param memberId
     * @param businessCode
     * @return
     */
	int inPackageOrder(String memberId, String businessCode);

   /**
    * 及时充值订单只有一条充值记录
    * @param oid
    * @return
    */
	YsOilcardRechargeInfo findOilcardRechargeInfoByOid(Long oid)  throws Exception;

	/**
	    * 套餐充值订单有多条充值记录
	    * @param oid
	    * @return
	    */
	List<OilcardRechargeInfoBean> findPackageORechargeInfoByOid(Long oid);


	
	
	public YsOilcardOrder findOilOrderInfo(String oilcardOrderNum);

	
	
	/**
	 * 充值
	 * oilCardRecharge:(). 
	 * @author fei 
	 * @Time：2017年5月25日 上午9:38:35
	 * @param oilcardOrderId
	 * @return
	 * @throws Exception
	 */
	 Map<String ,String>  oilCardRecharge(String oilcardOrderNum) throws Exception;
	
	 
	public  Map<String ,String> finishOilcardRechargeInfoRecharge(YsOilcardRechargeInfo oilcardOrderInfo) throws Exception;
	/**
	 * 油卡平台充值回调
	 * @param outTradeNo
	 * @param orderNo 油卡充值订单号
	 * @param createTime
	 * @param status
	 * YsOilcardOrder 为null 表示不需要通知， 不为null 表示需要通知，
	 */
	YsOilcardOrder rechargeCallBack(String outTradeNo,String orderNo,String createTime,int status,String memo);
	
	

	 Map<String ,String>  insertReplenish(YsOilcardRepOrder oilcardRepOrder, YsOilcardOrder order,YsOilcardRechargeInfo oilcardRechargeInfo) throws Exception;
	
	
	 List<YsOilcardRepOrder> selectByOilcardOrderId(BaseOilOrderInDTO listInDTO,Page page);

	 List<YsOilcardRepOrder> selectByOilcardReOrderId(Page page, Long ReOrderId);


	List<YsOilcardRechargeInfo> findNeedChargeChargeInfo(String date);


	/**
	 * 
	 * @param tradeNo
	 * @param outTradeNo
	 * @param price
	 * @return  TradeOffline 不为空表示 需要进行消费通知 为空表示 需要消费通知
	 */
	TradeOffline finishFlowsPayNotify(String tradeNo, String outTradeNo) throws Exception;


	List<YsFlowChargeOrder> searchNotifyErrorflowCharge(int page, int pageSize);


	List<OilcardChargeOrderBean> listOilcardCharge(OilcardChargeListInDTO listInDTO, Page page);


	Response bankPaySubmit(String groupId, Long memberId, Long orderId,String ip, Map<String, Object> params);


	Response oilChargeOrderBankPay(String groupId, Long memberId, Long cardId, Long goodsOrderId, Integer price,String ip);

	Response flowsOrderAliPay(String orderNum, Integer goodsOrderPrice, Long memberId, String groupId, String notifyUrl);


	Response flowsOrderBankPay(String groupId, Long memberId, Long cardId, String orderNum, Integer goodsOrderPrice, String notifyUrl,String ip);


	Response flowsOrderPay(String orderNum, String notifyUrl, Integer goodsOrderPrice, String payPwd, Long memberId, String groupId) throws Exception;


	Response flowsOrderWxPay(String orderNum, Integer goodsOrderPrice, Long memberId, String groupId, String ip, String notifyUrl);



	boolean verfyOilCardAliPay(HashMap<String, String> params, String out_trade_no);


	boolean verfyFlowChargeAliPay(HashMap<String, String> params, String out_trade_no);
	

	//油卡充值月任务
	public int saveOilcardChargeMonthTask(Date statisDate) throws Exception;


	boolean checkOilChargeSign(HttpServletRequest request);


	BaseOutDTO finishFlowsPayNotify(Long orderId);


	List<FlowChargeOrderBean> listFlowsCharge(FlowOrderListInDTO listInDTO, Page page);


	boolean checkOilChargeSign2(HttpServletRequest request);
	
	public List<OilcardRechargeInfoBean> listOilcardChargeByMemberCardId(OilCardOrderReChargeInDTO listInDTO, Page page);


	String finishCancelOilCharge(CancelOilChargeInDTO canceOilDTO);


	void saveFlowChargeDayStatis(Date statisDate) throws Exception;


	void saveOilChargeDayStatis(Date statisDate) throws Exception;


	OilChargeReportListOutDTO oilChargeReportList(BaseReportInDTO baseReportInDTO)throws Exception;


	OilChargeReportInfoListOutDTO oilChargeReportInfoList(BaseReportInDTO baseReportInDTO)throws Exception;


	FlowChargeReportListOutDTO flowChargeReportList(BaseReportInDTO baseReportInDTO)throws Exception;


	FlowChargeReportInfoListOutDTO flowChargeReportInfoList(BaseReportInDTO baseReportInDTO)throws Exception;

}
